<template>
  <el-dialog v-if="fileInfo.show" :title="fileInfo.title" style="top: -40px" :visible.sync="fileInfo.show" @close="close" width="90%" append-to-body>
    <vue-editor class="vue-editor" v-model="content"></vue-editor>
    <span slot="footer" class="dialog-footer">
    <el-button type="primary" @click="saveFile">保 存</el-button>
    <el-button @click="close">关 闭</el-button>
  </span>
  </el-dialog>
</template>

<script>
import { VueEditor } from 'vue2-editor';
export default {
  name: 'FileEdit',
  components: { VueEditor },
  props: {
    fileInfo: {
      type: Object
    }
  },
  data() {
    return {
      content: ''
    }
  },
  methods: {
    close() {
      this.$emit("close")
    },
    saveFile() {
      this.$emit("saveFile", this.fileInfo)
    }
  }
}
</script>

<style scoped>
.vue-editor /deep/ .ql-toolbar {
  display: none;
}
.vue-editor /deep/ #quill-container {
  border-top: 1px solid #ccc;
  height: 80vh;
}
</style>
